/*
 * @LastEditors: yuSeen
 * @LastEditTime: 2021-11-20 22:18:21
 * 天凉好个秋
 */
const koaRouter = require('koa-router')
import UserController from '../controller/userController'
import LoginController from '../controller/loginController'
import authMiddleware from '../middleware/authMiddleware'


const router = new koaRouter()
// 登录
router.post('/login', LoginController.index)
// 添加用户(注册)
router.post('/addUser', UserController.addUser)

// 权限校验中间件
router.use(authMiddleware)

// 根据用户名获取信息
router.get('/getUserByName', UserController.getUserByName)

// 获取用户列表
router.post('/getUserList', UserController.getUserList)

// 更新用户信息
router.put('/updateUser/:id', UserController.updateUser)

// 删除用户
router.delete('/deleteUser/:id', UserController.deleteUser)

export default router